<?php //$this->Html->script('jquery-1.4.2.min');                          ?>
<div class="widget grid12">
    <div class="whead"><h6>FORMULARIO DE EDICION </h6><div class="clear"></div></div>
    <?php echo $this->Form->create('Ordene', array('id' => "validate")); ?>
    
    <div class="formRow">
        <div class="grid3"><label>Orden de compra (PO):<span class="req">*</span></label></div>
        <div class="grid9">
            <?php echo $this->Form->text('Ordene.nombre', array('placeholder' => 'Ingrese la Orden Ej: CA-009', "class" => "validate[required, ajax[ajaxvalida]]")); ?>
        </div>
        <div class="clear"></div>
    </div>

    <div class="formRow">
        <div class="grid3"><label>Categoria :<span class="req">*</span></label></div>
        <div class="grid3">
             <?php echo $this->Form->select('Ordene.categoria_id', $dcc, array("class" => "validate[required]")); ?>
        </div>

        <div class="grid3"><label>Nro de CAJON :<span class="req">*</span></label></div>
        <div class="grid3">
             <?php echo $this->Form->text('Ordene.lugar', array('placeholder' => 'Ingrese el numero de CAJON')); ?>
        </div>
        <div class="clear"></div>
    </div>

 
    <div class="formRow">
        <div class="grid3"><label>Proveedor:</label></div>
        <div class="grid9">
            <?php echo $this->Form->text('Ordene.proveedor', array('placeholder' => 'Ingrese el proveedor')); ?>
        </div>
        <div class="clear"></div>
    </div>
    <div class="formRow">
        <div class="grid3"><label>Volumenes :</label></div>
        <div class="grid9">
            <?php echo $this->Form->text('Ordene.volumenes', array('id' => 's4', "class" => "validate[required]")); ?>                        
        </div>
        <div class="clear"></div>
    </div>    

    <div class="formRow">
        <div class="grid3"><label>CAF :</label></div>
        <div class="grid3">
            <?php echo $this->Form->text('Ordene.cantidadcaf', array('placeholder' => 'Ingrese Cantidad Ej: 2')); ?>
            <?php //echo $this->Form->text('Ordene.volumencaf', array('placeholder' => 'Ingrese Volumen Ej: 3', "class" => "validate[required]")); ?>
        </div>
        <div class="grid3">
            <?php //echo $this->Form->text('Ordene.cantidadcaf', array('placeholder' => 'Ingrese Cantidad Ej: 3', "class" => "validate[required]")); ?>
            <?php echo $this->Form->text('Ordene.volumencaf', array('placeholder' => 'Ingrese Volumen Ej: 3')); ?>
        </div>        
        <div class="clear"></div>
    </div>

    <div class="formRow">
        <div class="grid3"><label>Observaciones :</label></div>
        <div class="grid9">
            <?php echo $this->Form->hidden('DocumentosOrdene.seleccionados', array('id' => 'seleccionados', 'value' => 0)); ?>
            <?php echo $this->Form->text('Ordene.observaciones', array('placeholder' => 'Ingrese la Orden Ej: CA-009')); ?>
        </div>
        <div class="clear"></div>  
    </div>

    <div class="formRow">
        <div class="grid3"><label>Fecha :</label></div>
        <div class="grid9">
            <?php echo $this->Form->text('Ordene.fecha', array('id' => 'fechaPed', 'placeholder' => 'Ingrese la Fecha del Pedido Formato: (Ano-Mes-Dia)')); ?>
        </div>
        <div class="clear"></div>
    </div>

    <div class="formRow">
        <div class="grid3"><label>Monto :</label></div>
        <div class="grid4">
            <?php echo $this->Form->text('Ordene.monto', array('placeholder' => 'Ingrese Monto numeral Ej:1000')); ?>
        </div>
        <div class="grid4">    
            <?php echo $this->Form->text('Ordene.tipomoneda', array('placeholder' => 'Ingrese moneda Ej:$us')); ?>
        </div>
        <div class="clear"></div>
    </div>

    <div class="formRow">
        <div class="grid3"><label>descripcion:</label></div>
        <div class="grid9">
            <?php echo $this->Form->text('Ordene.descripcion', array('placeholder' => 'Ingrese la descricion')); ?>
        </div>
        <div class="clear"></div>
    </div>     

    <div class="formRow">
        <div class="grid3"><label>Original :</label></div>
        <div class="grid3">            
            <?php echo $this->Form->checkbox("Ordene.original", array('value' => 'S', 'hiddenField' => 'N')); ?>
        </div>

        <div class="grid3"><label>Cant Firmas :</label></div>
        <div class="grid3">            
            <?php echo $this->Form->text('Ordene.firmasoriginal', array('placeholder' => '0')); ?>
            <?php //echo $this->Form->checkbox("tagSel", array('value' => 1, 'hiddenField' => false)); ?>
        </div>
        <div class="clear"></div>
    </div>

    <div class="formRow">
        <div class="grid3"><label>Copia: </label></div>
        <div class="grid3">
            <?php echo $this->Form->checkbox("Ordene.copia", array('value' => "S", 'hiddenField' => 'N')); ?>
        </div>
        <div class="grid3"><label>Cant. Firmas :</label></div>
        <div class="grid3">
            <?php echo $this->Form->text('Ordene.firmascopia', array('placeholder' => '0')); ?>
        </div>        
        <div class="clear"></div>
    </div>

    <div class="clear"></div>


</div>
<script>
    $(document).ready(function() {
        
        $( "#fechaPed" ).datepicker({
            defaultDate: +7,
            showOtherMonths:true,
            autoSize: true,
            /*appendText: '(Ano-Mes-Dia)',*/
            dateFormat: 'yy-mm-dd',
            changeMonth: true,
            changeYear: true
        });        
        /* Init the table */
        var oTable = $('.dTable').dataTable( );
        
        /* Add/remove class to a row when clicked on */
        $('.dTable tr').click( function() {
            $(this).toggleClass('row_selected');               
        } );
        
        $('#btEnvia').hover( function() {
            //$(this).toggleClass('row_selected');  
            $.fn.getCheckboxValues = function(){
                var values = [];
                var i = 0;
                this.each(function(){
                    values[i++] = $(this).val();
                });
                return values;
            } 

            var arr = $("input:checked").getCheckboxValues();
            $("#seleccionados").val(arr);
            console.log('es'+arr);
        } );
        
        var sheepItForm = $('#sheepItForm').sheepIt({
            separator: '',
            allowRemoveLast: true,
            allowRemoveCurrent: true,
            allowRemoveAll: true,
            allowAdd: true,
            allowAddN: true,
            maxFormsCount: 150,
            minFormsCount: 1,
            iniFormsCount: 1,
            continuousIndex: true
        }); 
        
        $("#validate").keypress(function(e) {
            if (e.which == 13) {
                //alert('Presiono enter');
                return false;
                
            }
        });            
                 
            
    } );                 
    
</script>
    <div class="actions-right">
        <?php $options = array('label' => 'Guardar Datos','class' => 'buttonS bGreen','id' => 'btEnvia');echo $this->Form->end($options);?> 
        <p></p>
        <?php echo $this->Html->link("Volver &raquo;", array('controller'=>'Ordenes', 'action'=>'index'), array('class'=>'buttonS bLightBlue', 'escape' => FALSE)); ?>
    </div>
    

